All Functions Used So Far, Week 9

dnorm

{stats}

Density distribution for the normal distribution

levels

{base}

Get levels of a factor

as.numeric

{base}

Coerce a vector to numeric

colnames

{base}

Retrieve column names of a data frame

plot

{graphics}

Generic function from base R to produce a plot

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

range

{base}

Return range of values

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

ungroup

{dplyr}

Resolve grouping created with “group_by”

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

setwd

{base}

Set Working Directory

prop.test

{stats}

Test of Equal or Given Proportions

labs

{GGPLOT2}

Customise labels in GGPLOT2

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

geom_segment

{GGPLOT2}

Generates a line segment or curve

library

{base}

Load an R package

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

save

{base}

Writes an external representation of R objects to the specified file.

as.character

{base}

Coerce a vector to character

rnorm

{base}

Generate random numbers from a normal distribution

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

n

{dplyr}

The number of observations in the current group.

stat_ecdf

{GGPLOT2}

Compute empirical cumulative distribution

spread

{tidyr}

Spread a key-value pair across multiple columns

element_text

{GGPLOT2}

Customise text in GGPLOT2

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

geom_density

{GGPLOT2}

Generates a density plot

summary

{base}

Obtain summary statistics or detailed regression output

separate

{dplyr}

Separate a character column into multiple columns

var

{stats}

Calculate variance

seq

{base}

Create a sequence

select

{dplyr}

Select columns from a tibble/data frame

sum

{base}

Get sum of numeric values or a vector

View

{base}

View a data frame

desc

{dplyr}

Arrange in descending order

read_dta

{haven}

Read a .dta file (Stata data)

read_excel

{readxl}

Read an Excel file

factor

{base}

Create a factor

recode

{dplyr}

Recode a variable

max

{base}

Get maximum of a vector

element_line

{GGPLOT2}

Customise line appearance

ifelse

{base}

Return a or b depending on the value of test

names

{base}

Retrieve names of a list/vector

sqrt

{stats}

Square root

geom_hline

{GGPLOT2}

Add a horizontal line in GGPLOT2

complete.cases

{stats}

Find Complete Cases

element_blank

{GGPLOT2}

This theme element draws nothing, and assigns no space

quantile

{stats}

Obtain empirical quantiles of a vector

length

{base}

Returns number of elements in an object

set.seed

{base}

Initialise a pseudorandom number generator.

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

sd

{stats}

Get standard deviation of a vector

filter

{dplyr}

Filter out rows of a data frame according to logical vector

head

{utils}

Show first 5 rows of a data frame

expression

{base}

Used in plots to add symbols to axes

min

{base}

Get minimum of a vector

geom_ribbon

{GGPLOT2}

Generates an area plot

geom_histogram

{GGPLOT2}

Generates a histogram

hist

{graphics}

Plot a simple histogram

ordered

{dplyr}

Create an ordered factor

which.max

{base}

return index of the largest value in a vector

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

str

{utils}

Get the structure of an R object

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

write.csv

{utils}

write a csv file to a data frame

median

{stats}

Get median of a vector

with

{base}

evaluate expression in the context of a data frame

cut

{base}

Convert Numeric to Factor

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

boxplot

{graphics}

Plot a simple box plot

is.na

{base}

Check if a value is NA/elements of vector are NA

mean

{base}

Get mean of a vector

nrow

{base}

Get number of rows of a data frame

tibble

{tibble}

A modern data frame from the tidyverse

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

geom_line

{GGPLOT2}

Generates a line

rm

{base}

Remove objects

data.frame

{base}

Create a data.frame from vectors

par

{graphics}

Set parameters of the plotting device

mutate

{dplyr}

Modify/create a column in a data frame

slice

{dplyr}

Subset rows using their positions

ggsave

{ggplot2}

Saves the last ggplot or a specified ggplot object to a file

c

{base}

Combine values/vectors into a vector

ggplot

{GGPLOT2}

Create a ggplot graph

print

{base}

Print object to the console

theme

{GGPLOT2}

Set theme for GGPLOT2

install.packages

{base}

Install R package

The end!